package org.qpcr.community.device.entity;


import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import org.hswebframework.ezorm.rdb.mapping.annotation.ColumnType;
import org.hswebframework.ezorm.rdb.mapping.annotation.Comment;
import org.hswebframework.ezorm.rdb.mapping.annotation.DefaultValue;
import org.hswebframework.web.api.crud.entity.GenericEntity;
import org.hswebframework.web.api.crud.entity.RecordCreationEntity;
import org.hswebframework.web.api.crud.entity.RecordModifierEntity;
import org.hswebframework.web.crud.annotation.EnableEntityEvent;
import org.hswebframework.web.crud.generator.Generators;
import org.hswebframework.web.validator.CreateGroup;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import java.sql.JDBCType;


@Getter
@Setter
@Table(name = "biz_calibration_cmd")
@Comment("校准指令")
@EnableEntityEvent
public class CalibrationCmdEntity extends GenericEntity<String>  implements RecordCreationEntity, RecordModifierEntity {
    @Override
    @Id
    @Column(length = 64, updatable = false)
    @Schema(description = "ID")
    @GeneratedValue(generator = Generators.SNOW_FLAKE)
    @NotBlank(message = "ID不能为空", groups = CreateGroup.class)
    public String getId() {
        return super.getId();
    }

    @Column(name = "creator_id", updatable = false)
    @Schema(
        description = "创建者ID(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String creatorId;

    @Column(name = "creator_name", updatable = false)
    @Schema(
        description = "创建者名称(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String creatorName;

    @Column(name = "create_time", updatable = false)
    @DefaultValue(generator = Generators.CURRENT_TIME)
    @Schema(
        description = "创建时间(只读)"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private Long createTime;

    @Column
    @DefaultValue(generator = Generators.CURRENT_TIME)
    @Schema(
        description = "修改时间"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private Long modifyTime;

    @Column(length = 64)
    @Schema(
        description = "修改人ID"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String modifierId;

    @Column(length = 64)
    @Schema(
        description = "修改人名称"
        , accessMode = Schema.AccessMode.READ_ONLY
    )
    private String modifierName;

    @Column(length = 64,name = "command_type")
    @Schema(description = "指令类型")
    private String commandType;


    @Column(length = 64,name = "command_name")
    @Schema(description = "指令类型名称")
    private String commandTypeName;

    @Column(length = 64,name = "message_id")
    @Schema(description = "消息ID")
    private String messageId;

    @Column(length = 64,name = "device_id")
    @Schema(description = "设备ID")
    private String deviceId;

    @Column(length = 3,name = "module_code")
    @Schema(description = "模块编号")
    private String moduleCode;

    @Column(length = 10,name = "status")
    @Schema(description = "status")
    private String status;

    @Column(name = "request_body")
    @Schema(description = "请求报文")
    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
    private String requestBody;

    @Column(name = "response_body")
    @Schema(description = "响应报文")
    @ColumnType(jdbcType = JDBCType.LONGVARCHAR)
    private String responseBody;

    @Column(length = 64,name = "business_type")
    @Schema(description = "业务类型")
    private String businessType;

    @Column(length = 1024,name = "remark")
    @Schema(description = "备注")
    private String remark;
}
